﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/default.Master" AutoEventWireup="true"
    CodeBehind="Plan-Monitoring-Schedule.aspx.cs" Inherits="NRCP.Plan_Monitoring_Schedule" %>

<%@ Import Namespace="NRCP.Helpers" %>
<%@ Register Assembly="NRCP" Namespace="UI.Library.Web" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="<%= SiteSettings.BaseUrl %>Scripts/JqueryUI/css/smoothness/jquery-ui-1.9.2.custom.css"
        rel="stylesheet" type="text/css" />
    <script src="<%= SiteSettings.BaseUrl %>Scripts/JqueryUI/jquery-ui-1.9.2.custom.js"
        type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var selectedMonthNo = $("#<%= ddlMonth.ClientID %>").val();
            var planYear = $("#<%= hidPlanYear.ClientID %>").val();
            var mydate = new Date("1/" + selectedMonthNo + "/" + planYear);
            var totaldays = daysInMonth(selectedMonthNo, planYear);
            $(".datepicker").datepicker({
                numberOfMonths: 1,
                changeMonth: false,
                changeYear: false,
                minDate: mydate,
                maxDate: "1/" + totaldays + "/" + planYear,
                defaultDate: mydate
            });
        });

        function daysInMonth(month, year) {
            return new Date(year, month, 0).getDate();
        }   
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <br />
    <div class="grid_20">
        <cc1:ResponseMessage ID="respMessage" runat="server"></cc1:ResponseMessage>
    </div>
    <div class="grid_20 alpha">
        <label>
            Region
        </label>
        <br />
        <asp:DropDownList ID="ddlRegion" runat="server">
        </asp:DropDownList>
        <br />
        <label>
            Month</label>
        <br />
        <asp:DropDownList ID="ddlMonth" runat="server">
        </asp:DropDownList>
        <br />
        <asp:HiddenField ID="hidPlanYear" runat="server" />
        <asp:Button ID="btnShow" runat="server" Text="Show" CssClass="button medium gray"
            OnClick="btnShow_Click" />
        <br class="clear" />
        <table id="dataTable" class="mGrid">
            <tr>
                <th>
                    Sample Collection Date
                </th>
                <th>
                    Place of Sampling
                </th>
                <th>
                    Type of Sample
                </th>
                <th>
                    Type Of Test
                </th>
                <th>
                    Quantity
                </th>
                <th>
                    Name of Inspector
                </th>
            </tr>
            <asp:Repeater ID="repMonitorSchedule" runat="server" 
                onitemdatabound="repMonitorSchedule_ItemDataBound">
                <ItemTemplate>
                    <tr>
                        <td>
                            <asp:TextBox ID="txtPlanDate" runat="server" CssClass="datepicker text-medium" Text='<%# Eval("SampleDate")!=null? Convert.ToDateTime(Eval("SampleDate")).ToShortDateString():""%>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rfvtxtPlanDate" runat="server" ControlToValidate="txtPlanDate" ValidationGroup="valgrpSchedule" Display="Static" ErrorMessage="* required" CssClass="validation-message"></asp:RequiredFieldValidator>
                            <asp:HiddenField ID="hidSample" runat="server" Value='<%# Eval("MonthlyId")%>' />
                             <asp:HiddenField ID="hidScheduleId" runat="server" Value='<%# Eval("ScheduleId")%>' />
                        </td>
                        <td>
                            <%# Eval("Upazila")%>
                        </td>
                        <td>
                            <%# Eval("FishType")%>
                        </td>
                        <td>
                            <%# Eval("TestType")%>
                        </td>
                        <td>
                            <%# Eval("Count")%>
                            Kg
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlInspector" runat="server" DataTextField="Name" DataValueField="Id">
                            </asp:DropDownList>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
        </table>
        <br class="clear" />
        <asp:Button ID="btnSubmit" runat="server" Text="Save All" Visible="false" CssClass="button medium green" ValidationGroup="valgrpSchedule"
            OnClick="btnSubmit_Click" />
    </div>
</asp:Content>
